package com.ismarkendenis.crc;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		CRCCollisionDetector crc = new CRCCollisionDetector();
		boolean[] divisor = {true,false,false,true,true};
		//11010110.
		boolean[] bitstreaml = {true, true, false, true, false, true, true, false};
		
		for (int j = 0; j < Math.pow(2,5); j++) {
			boolean[] bitstream = {true, true, true, false, false, false, false, false};
			int bitstreamint = j;
			if (bitstreamint > 16) {
				bitstream[3] = true;
				bitstreamint -= 16;
			}
			if (bitstreamint > 8) {
				bitstream[4] = true;
				bitstreamint -= 8;
			}
			if (bitstreamint > 4) {
				bitstream[5] = true;
				bitstreamint -= 4;
			}
			if (bitstreamint > 2) {
				bitstream[6] = true;
				bitstreamint -= 2;
			}
			if (bitstreamint == 1) {
				bitstream[7] = true;
				bitstreamint -= 1;
			}
			boolean[] bitstream2 = bitstream.clone();
			boolean[] test = crc.crcBitStreamResult(bitstream, divisor);
			
			String desiredResult = "00000010";
			String bistreamString = "";
			String resultString = "";
			for (int i = 0; i < bitstream2.length; i++) {
				if(bitstream2[i] == false){
					bistreamString += "0"; 
				}
				else{
					bistreamString += "1";
				}
				
			}
			for (int i = 0; i < test.length; i++) {
				if(test[i] == false){
					resultString += "0"; 
				}
				else{
					resultString += "1";
				}
				
			}
			System.out.println(bistreamString + " - " + resultString + " + " + resultString.compareTo(desiredResult));
		}
	}

}
